home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / clipper / ks94an.zip / XDUP.HDR < prev    next >
Text File  |  1994-04-25  |  2KB  |  57 lines

  1. /******************************************************************************
  2.                  The Klipper Library, for CA-Clipper 5.x
  3.         Copyright (c), 1994, Wallace Information Systems Engineering
  4.  
  5. FUNCTION:
  6.  
  7. _XDup( cOutFile, lKeep ) --> nRecsDeleted
  8.  
  9. PARAMETERS:
  10.  
  11. cOutFile  : Optional - Output file to contain duplicate records
  12. lKeep     : Keep First/Last occurance. TRUE = First (default) FALSE = Last
  13.  
  14. SHORT:
  15.  
  16. Delete duplicate records in a database based upon index key.
  17.  
  18. DESCRIPTION:
  19.  
  20. _XDup() will check the file in the CURRENT WORKAREA for duplicate records
  21. ACCORDING TO THE FILE'S CURRENT INDEX KEY.  When duplicates are found, if
  22. cOutFile is not specified, the duplicate records are deleted.  If cOutFile is
  23. specified, duplicate records are deleted after being copied to the file named
  24. in cOutFile.
  25.  
  26. If lKeep = TRUE, the FIRST record from a group of duplicate records is kept,
  27. the rest are deleted/copied.  If FALSE, then the LAST record from a group of
  28. duplicates is kept/copied.
  29.  
  30. _XDup() returns the number of duplicate records deleted. If no index is
  31. currently open, the function immediately returns -1.
  32.  
  33. The file being checked must be open in EXCLUSIVE mode.
  34.  
  35. NOTE:
  36.  
  37. This is not a thouroughly tested function.  Use caution.
  38.  
  39. EXAMPLE:
  40.  
  41. USE file.dbf
  42. SET INDEX TO file.ntx  // keyed on LastName+FirstName
  43.  
  44. _XDup()
  45.  
  46.  
  47. Result: No parameters were passed, so the defaults of No Copy File and
  48. Keep First apply.  All duplicate records are simply deleted and the
  49. FIRST occurance of each duplicate is kept.
  50.  
  51. _XDup('TEMP.DBF',FALSE)
  52.  
  53. Result: Duplicate records are copied to TEMP.DBF before being deleted.
  54. The LAST record in each group of duplicates is kept.
  55.  
  56. ******************************************************************************/
  57.